# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=bbscan
pkgver=53.29b9f11
pkgrel=1
pkgdesc='A tiny Batch web vulnerability Scanner.'
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner' 'blackarch-fuzzer')
arch=('any')
url='https://github.com/lijiejie/bbscan'
license=('Apache')
depends=('python2' 'python2-beautifulsoup4' 'python2-ipaddress' 'python2-gevent'
         'python2-urllib3' 'python2-requests')
makedepends=('git')
source=("$pkgname::git+https://github.com/lijiejie/BBScan.git")
sha512sums=('SKIP')

pkgver() {
	cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
	cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 BBScan.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

